Class symantec.itools.awt.DirectionButton
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class symantec.itools.awt.DirectionButton

Object
   |
   +----Component
           |
           +----Canvas
                   |
                   +----ButtonBase
                           |
                           +----symantec.itools.awt.DirectionButton

public class DirectionButton
extends ButtonBase
implements Serializable
The DirectionButton is a button component that has an arrow drawn in it that points one of four ways (left, up, right, or down). At runtime, the button has a raised look and a pressed look.

This component is usually used in conjunction with a combo or list box to indicate a list that the user can view by clicking the arrow, or with spinners to let the user scroll through available values.

Version:
1.1, June 27, 1997
Author:
Symantec

Variable Index

 o DOWN
The point DOWN style constant.
 o LEFT
The point LEFT style constant.
 o RIGHT
The point RIGHT style constant.
 o UP
The point UP style constant.
 o arrowColor
The color of the arrow in the button.
 o bottom
The number of pixels to shrink the arrow from the bottom side of the button.
 o direction
The direction the arrow points.
 o disabledArrowColor
The color of the arrow when the button is disabled.
 o errors
Error strings.
 o indent
The margin around the arrow in pixels.
 o left
The number of pixels to shrink the arrow from the left side of the button.
 o right
The number of pixels to shrink the arrow from the right side of the button.
 o tempIndent
Internal use.
 o top
The number of pixels to shrink the arrow from the top side of the button.

Constructor Index

 o symantec.itools.awt.DirectionButton()
Constructs a default DirectionButton, which will point left.
 o symantec.itools.awt.DirectionButton(int)
Constructs a DirectionButton pointing the specified direction.

Method Index

 o addArrowIndentListener(PropertyChangeListener)
Adds a listener for the ArrowIndent property changes.
 o addArrowIndentListener(VetoableChangeListener)
Adds a vetoable listener for the ArrowIndent property changes.
 o addDirectionListener(PropertyChangeListener)
Adds a listener for the Direction property changes.
 o addDirectionListener(VetoableChangeListener)
Adds a vetoable listener for the Direction property changes.
 o addNotify()
Tells this component that it has been added to a container.
 o addPropertyChangeListener(PropertyChangeListener)
Adds a listener for all event changes.
 o addVetoableChangeListener(VetoableChangeListener)
Adds a vetoable listener for all event changes.
 o fillTriangle(Graphics, int, int, int, int, int, int, int)
Fills a triangle which has at least one side that is straight up and down or left and right.
 o getArrowColor()
Gets the current color of the direction arrow.
 o getArrowIndent()
Returns the amount of blank space between the arrow and the button border in pixels.
 o getDirection()
Returns the direction the button is currently pointing.
 o getMinimumSize()
Returns the minimum dimensions to properly display this component.
 o getPreferredSize()
Returns the recommended dimensions to properly display this component.
 o isValidArrowIndent(int)
Is the given arrow indent is valid for this button.
 o isValidBevelSize(int)
Is the given bevel size valid for this button.
 o isValidDirection(int)
Is the given direction valid for this button.
 o removeArrowIndentListener(PropertyChangeListener)
Removes a listener for the ArrowIndent property changes.
 o removeArrowIndentListener(VetoableChangeListener)
Removes a vetoable listener for the ArrowIndent property changes.
 o removeDirectionListener(PropertyChangeListener)
Removes a listener for the Direction property changes.
 o removeDirectionListener(VetoableChangeListener)
Removes a vetoable listener for the Direction property changes.
 o removeNotify()
Tells this component that it is being removed from a container.
 o removePropertyChangeListener(PropertyChangeListener)
Removes a listener for all event changes.
 o removeVetoableChangeListener(VetoableChangeListener)
Removes a vetoable listener for all event changes.
 o setArrowColor(Color)
Sets the color of the direction arrow.
 o setArrowIndent(int)
Sets the amount of blank space between the arrow and the button border in pixels.
 o setDirection(int)
Sets the direction of the arrow after construction.
 o shrinkTriangle(int, int, int, int)
Sets the extra amount, in pixels, to shrink the arrow triangle.
 o updateButtonImage()
Maintains the buttonImage size and draws the button in the buttonImage offscreen image.
 o verifyContstrainedPropertyValues()
Called after addNotify to set the internally constrined properties to their temporary values to validate them now that the component has been added to the form.

Variables

 o DOWN
public static final int DOWN
The point DOWN style constant.

 o LEFT
public static final int LEFT
The point LEFT style constant.

 o RIGHT
public static final int RIGHT
The point RIGHT style constant.

 o UP
public static final int UP
The point UP style constant.

 o arrowColor
protected java.awt.Color arrowColor
The color of the arrow in the button.

 o bottom
protected int bottom
The number of pixels to shrink the arrow from the bottom side of the button.

 o direction
protected int direction
The direction the arrow points. One of: LEFT, UP, RIGHT, or DOWN.

See Also:
LEFT, UP, RIGHT, DOWN
 o disabledArrowColor
protected java.awt.Color disabledArrowColor
The color of the arrow when the button is disabled.

 o errors
protected transient java.util.ResourceBundle errors
Error strings.

 o indent
protected int indent
The margin around the arrow in pixels. 0 = arrow takes up entire button.

 o left
protected int left
The number of pixels to shrink the arrow from the left side of the button.

 o right
protected int right
The number of pixels to shrink the arrow from the right side of the button.

 o tempIndent
protected int tempIndent
Internal use. Indent value stored until this component is added to a container. It is then used to set the real indent value. This avoids code-gen order dependencies.

 o top
protected int top
The number of pixels to shrink the arrow from the top side of the button.

Constructors

 o DirectionButton
public DirectionButton()
Constructs a default DirectionButton, which will point left.

 o DirectionButton
public DirectionButton(int d)
Constructs a DirectionButton pointing the specified direction.

Parameters:
d - a style constant indicating which direction to point the button
See Also:
LEFT, UP, RIGHT, DOWN

Methods

 o addArrowIndentListener
public synchronized void addArrowIndentListener(PropertyChangeListener listener)
Adds a listener for the ArrowIndent property changes.

Parameters:
listener - the listener to add.
See Also:
removeArrowIndentListener
 o addArrowIndentListener
public synchronized void addArrowIndentListener(VetoableChangeListener listener)
Adds a vetoable listener for the ArrowIndent property changes.

Parameters:
listener - the listener to add.
See Also:
removeArrowIndentListener
 o addDirectionListener
public synchronized void addDirectionListener(PropertyChangeListener listener)
Adds a listener for the Direction property changes.

Parameters:
listener - the listener to add.
See Also:
removeDirectionListener
 o addDirectionListener
public synchronized void addDirectionListener(VetoableChangeListener listener)
Adds a vetoable listener for the Direction property changes.

Parameters:
listener - the listener to add.
See Also:
removeDirectionListener
 o addNotify
public synchronized void addNotify()
Tells this component that it has been added to a container. This is a standard Java AWT method which gets called by the AWT when this component is added to a container. Typically, it is used to create this component's peer. It has been overridden here to hook-up event listeners.

Overrides:
addNotify in class ButtonBase
See Also:
removeNotify
 o addPropertyChangeListener
public synchronized void addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener for all event changes.

Parameters:
listener - the listener to add.
Overrides:
addPropertyChangeListener in class ButtonBase
See Also:
removePropertyChangeListener
 o addVetoableChangeListener
public synchronized void addVetoableChangeListener(VetoableChangeListener listener)
Adds a vetoable listener for all event changes.

Parameters:
listener - the listener to add.
Overrides:
addVetoableChangeListener in class ButtonBase
See Also:
removeVetoableChangeListener
 o fillTriangle
protected void fillTriangle(Graphics g,
                            int tipX,
                            int tipY,
                            int aX,
                            int aY,
                            int bX,
                            int bY,
                            int direction)
Fills a triangle which has at least one side that is straight up and down or left and right.

Parameters:
g - the Graphics to use to draw with.
tipX - the horizontal coordinate of the point opposite a straight side.
tipY - the vertical coordinate of the point opposite a straight side.
aX - the horizontal coordinate of one of the two points defining the straight side.
aY - the vertical coordinate of one of the two points defining the straight side.
bX - the horizontal coordinate of one of the two points defining the straight side.
bY - the vertical coordinate of one of the two points defining the straight side.
direction - the direction of the straight line UP, DOWN, or LEFT, RIGHT. aX and bX should be the same for UP or Down. aY and bY should be the same for LEFT or RIGHT. If not, then the a coordinates are used.
See Also:
UP, DOWN, LEFT, RIGHT
 o getArrowColor
public java.awt.Color getArrowColor()
Gets the current color of the direction arrow.

Returns:
the current arrow color
See Also:
setArrowColor
 o getArrowIndent
public int getArrowIndent()
Returns the amount of blank space between the arrow and the button border in pixels.

See Also:
setArrowIndent
 o getDirection
public int getDirection()
Returns the direction the button is currently pointing.

See Also:
setDirection, LEFT, UP, RIGHT, DOWN
 o getMinimumSize
public java.awt.Dimension getMinimumSize()
Returns the minimum dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the minimum size of this component.

Returns:
a button that has a content area of 3 by 3 pixels.
Overrides:
getMinimumSize in class ButtonBase
See Also:
getMinimumSize
 o getPreferredSize
public java.awt.Dimension getPreferredSize()
Returns the recommended dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the recommended size of this component.

Returns:
a button that has a content area of 7 by 7 pixels.
Overrides:
getPreferredSize in class ButtonBase
See Also:
getMinimumSize
 o isValidArrowIndent
protected boolean isValidArrowIndent(int i)
Is the given arrow indent is valid for this button.

Parameters:
i - the given bevel size
Returns:
true if the given indent size is acceptable, false if not.
 o isValidBevelSize
protected boolean isValidBevelSize(int i)
Is the given bevel size valid for this button.

Parameters:
i - the given bevel size
Returns:
true if the given bevel size is acceptable, false if not.
Overrides:
isValidBevelSize in class ButtonBase
 o isValidDirection
protected boolean isValidDirection(int i)
Is the given direction valid for this button.

Parameters:
i - the given bevel size
Returns:
true if the given direction is acceptable, false if not.
 o removeArrowIndentListener
public synchronized void removeArrowIndentListener(PropertyChangeListener listener)
Removes a listener for the ArrowIndent property changes.

Parameters:
listener - the listener to remove.
See Also:
addArrowIndentListener
 o removeArrowIndentListener
public synchronized void removeArrowIndentListener(VetoableChangeListener listener)
Removes a vetoable listener for the ArrowIndent property changes.

Parameters:
listener - the listener to remove.
See Also:
addArrowIndentListener
 o removeDirectionListener
public synchronized void removeDirectionListener(PropertyChangeListener listener)
Removes a listener for the Direction property changes.

Parameters:
listener - the listener to remove.
See Also:
addDirectionListener
 o removeDirectionListener
public synchronized void removeDirectionListener(VetoableChangeListener listener)
Removes a vetoable listener for the Direction property changes.

Parameters:
listener - the listener to remove.
See Also:
addDirectionListener
 o removeNotify
public synchronized void removeNotify()
Tells this component that it is being removed from a container. This is a standard Java AWT method which gets called by the AWT when this component is removed from a container. Typically, it is used to destroy the peers of this component and all its subcomponents. It has been overridden here to unhook event listeners.

Overrides:
removeNotify in class ButtonBase
See Also:
addNotify
 o removePropertyChangeListener
public synchronized void removePropertyChangeListener(PropertyChangeListener listener)
Removes a listener for all event changes.

Parameters:
listener - the listener to remove.
Overrides:
removePropertyChangeListener in class ButtonBase
See Also:
addPropertyChangeListener
 o removeVetoableChangeListener
public synchronized void removeVetoableChangeListener(VetoableChangeListener listener)
Removes a vetoable listener for all event changes.

Parameters:
listener - the listener to remove.
Overrides:
removeVetoableChangeListener in class ButtonBase
See Also:
addVetoableChangeListener
 o setArrowColor
public void setArrowColor(Color newValue) throws PropertyVetoException
Sets the color of the direction arrow.

Parameters:
newValue - the new arrow color.
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getArrowColor
 o setArrowIndent
public void setArrowIndent(int ai) throws PropertyVetoException
Sets the amount of blank space between the arrow and the button border in pixels.

Parameters:
ai - the margin around the arrow in pixels. 0=arrow takes up entire button
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getArrowIndent
 o setDirection
public void setDirection(int d) throws PropertyVetoException
Sets the direction of the arrow after construction.

Parameters:
d - constant indicating direction to point button
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getDirection, LEFT, UP, RIGHT, DOWN
 o shrinkTriangle
public void shrinkTriangle(int l,
                           int r,
                           int t,
                           int b)
Sets the extra amount, in pixels, to shrink the arrow triangle. Constrains the values such that the arrow will never be less than three pixels. If a value is entered that would exceed this limit, the limit will be used instead.

Parameters:
left - pixels to shrink from left side
right - pixels to shrink from right side
top - pixels to shrink from top
bottom - pixels to shrink from bottom
 o updateButtonImage
protected void updateButtonImage()
Maintains the buttonImage size and draws the button in the buttonImage offscreen image.

Overrides:
updateButtonImage in class ButtonBase
See Also:
updateButtonImage
 o verifyContstrainedPropertyValues
protected void verifyContstrainedPropertyValues()
Called after addNotify to set the internally constrined properties to their temporary values to validate them now that the component has been added to the form. This is used to avoid code-gen order dependencies, since VC generates all property manipulating code before adding the component to its container. Subclasses should override this function for any internally constrained properties, and call the super version in the overridden version.

Overrides:
verifyContstrainedPropertyValues in class ButtonBase

All Packages  Class Hierarchy  This Package  Previous  Next  Index